#include "uibaseimpl.h"
#include "uimessageloopimpl.h"
#include "uiwindowimpl.h"
#include "uicontrolimpl.h"

CUiBaseImpl::CUiBaseImpl(void)
{
}
CUiBaseImpl::~CUiBaseImpl(void)
{
    logi("CUiBaseImpl::~CUiBaseImpl");
}
HRESULT CUiBaseImpl::Init(IBase* pRot, IBase* pBase)
{
    rc_error(pRot != NULL, E_FAIL);
    return pRot->QueryInterface(IID_IRot, (void**)&m_pRot);
}
HRESULT CUiBaseImpl::Uninit()
{
    HRESULT hr = S_OK;

    return hr;
}

HRESULT CUiBaseImpl::Start(_pid_t pid, unsigned int type)
{
    HRESULT hr = S_OK;

    return S_OK;
}
HRESULT CUiBaseImpl::Stop(unsigned int exit)
{
    HRESULT hr = S_OK;

    return hr;
}
HRESULT CUiBaseImpl::CreateControl(UIType type, IBase** pControl)
{
    HRESULT hr = S_OK;

    if (IS_UI_MESSAGELOOP(type)) {
        CUiMessageloopImpl* pObject = NULL;
        pObject = ALLOC_NEW CUiMessageloopImpl;
        rc_error(pObject != NULL, E_FAIL);
        return pObject->QueryInterface(IID_IUIMessageLoop, (void**)pControl);

    }
#if (TARGET_OS == OS_WIN)
    else if (IS_UI_WINDOWS(type)) {

        CUiWindowsImpl* pObject = NULL;
        pObject = ALLOC_NEW CUiWindowsImpl;
        rc_error(pObject != NULL, E_FAIL);
        return pObject->QueryInterface(IID_IUIWindow, (void**)pControl);

    } else if (IS_UI_BUTTON(type)) {
    }

#endif

    return hr;
}
